#include <iostream>
#include "GraphOrientedWeightedMatrix.h"

using namespace std;

GraphOrientedWeightedMatrix::GraphOrientedWeightedMatrix(summit_t n, edges_t m) : GraphOrientedWeighted::GraphOrientedWeighted(n,m), GraphOrientedMatrix::GraphOrientedMatrix(n,m), GraphWeightedMatrix::GraphWeightedMatrix(n,m)
{
  cerr<<"Constructeur paramétré de GraphOrientedWeightedMatrix"<<endl;
  weight = new weight_t * [n];
  for (int i(0); i<n; i++)
  {
    weight[i] = new weight_t [n];
  }
  summit_nb = n;
  edges_nb = m;
  //GraphOrientedMatrix::fill();
}

GraphOrientedWeightedMatrix::~GraphOrientedWeightedMatrix() { cerr<<"Constructeur par défaut de GraphOrientedWeightedMatrix"<<endl; }

bool GraphOrientedWeightedMatrix::areConnected(summit_t i, summit_t j) const { return GraphOrientedMatrix::areConnected(i,j); }
vector<summit_t> * GraphOrientedWeightedMatrix::getNeighbours(summit_t v) const { return GraphOrientedMatrix::getNeighbours(v);}
void GraphOrientedWeightedMatrix::connect(summit_t i, summit_t j) { return GraphOrientedMatrix::connect(i,j);}
void GraphOrientedWeightedMatrix::deconnect(summit_t i, summit_t j) { return GraphOrientedMatrix::deconnect(i,j);}


weight_t GraphOrientedWeightedMatrix::getWeight(summit_t i, summit_t j) const
{
  if ((i<summit_nb) && (j<summit_nb) && (i>=0) && (j>=0))
    return weight[i][j];
  return -1;
}

void GraphOrientedWeightedMatrix::setWeight(summit_t i, summit_t j, weight_t w)
{
  if ((i<summit_nb) && (j<summit_nb) && (i>=0) && (j>=0))
    weight[i][j]=w; 
}

